/**
 * 自定义指令
 */
Vue.directive('pin', function(el, binding, vnode) {
        console.log(binding.value)
        var position =  binding.modifiers
        var warning = binding.arg
        if(binding.value){
            el.style.position = "fixed"
           
            if(position){
                for (var key in position){
                    if (position[key]){
                        el.style[key] = '10px'
                        el.style[key] = '10px'
                    }
                }
            }
            if(warning){
                el.style.background = "orange"
            }
        } else{
            el.style.position = "static"
        }
        
    });


var app = new Vue({
    el : "#app",
    data : {
        card1 : {
            pined: false
        },
        card2 : {
            pined: false
        }     
    },
    methods : {
        onClick : function(){
            console.log("pined")
            this.pined = !this.pined
        }
    }
})